package com.community.charge.service.impl;

import java.util.List;

import com.community.charge.domain.vo.ChargeItemVo;
import com.community.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.community.charge.mapper.ChargeItemMapper;
import com.community.charge.domain.ChargeItem;
import com.community.charge.service.IChargeItemService;

/**
 * itemaService业务层处理
 * 
 * @author mdh
 * @date 2025-10-27
 */
@Service
public class ChargeItemServiceImpl implements IChargeItemService 
{
    @Autowired
    private ChargeItemMapper chargeItemMapper;

    /**
     * 查询itema
     * 
     * @param chargeItemId itema主键
     * @return itema
     */
    @Override
    public ChargeItem selectChargeItemByChargeItemId(Long chargeItemId)
    {
        return chargeItemMapper.selectChargeItemByChargeItemId(chargeItemId);
    }

    /**
     * 查询itema列表
     * 
     * @param chargeItem itema
     * @return itema
     */
    @Override
    public List<ChargeItem> selectChargeItemList(ChargeItem chargeItem)
    {
        return chargeItemMapper.selectChargeItemList(chargeItem);
    }

    /**
     * 新增itema
     * 
     * @param chargeItem itema
     * @return 结果
     */
    @Override
    public int insertChargeItem(ChargeItem chargeItem)
    {
        chargeItem.setCreateTime(DateUtils.getNowDate());
        return chargeItemMapper.insertChargeItem(chargeItem);
    }

    /**
     * 修改itema
     * 
     * @param chargeItem itema
     * @return 结果
     */
    @Override
    public int updateChargeItem(ChargeItem chargeItem)
    {
        chargeItem.setUpdateTime(DateUtils.getNowDate());
        return chargeItemMapper.updateChargeItem(chargeItem);
    }

    /**
     * 批量删除itema
     * 
     * @param chargeItemIds 需要删除的itema主键
     * @return 结果
     */
    @Override
    public int deleteChargeItemByChargeItemIds(Long[] chargeItemIds)
    {
        return chargeItemMapper.deleteChargeItemByChargeItemIds(chargeItemIds);
    }

    /**
     * 删除itema信息
     * 
     * @param chargeItemId itema主键
     * @return 结果
     */
    @Override
    public int deleteChargeItemByChargeItemId(Long chargeItemId)
    {
        return chargeItemMapper.deleteChargeItemByChargeItemId(chargeItemId);
    }

    //点击禁用按钮禁用
    @Override
    public Integer disable(Integer id) {
        return chargeItemMapper.disable(id);
    }

    //点击启用按钮启用
    @Override
    public Integer enable(Integer id) {
        return chargeItemMapper.enable(id);
    }

    //绑定收费项目下拉框
    @Override
    public List<ChargeItemVo> getChargeItem() {
        return chargeItemMapper.getChargeItem();
    }
}
